/* 
 用来放置一些全局方法的
在main 中全局调用
	import operate from "common/operate.js" 
	Vue.prototype.$operate = operate
*/

export default {
	//接口
	api: "http://192.168.208.126:8080",

	//吐司
	toast: function(options) {
		let {
			title,
			duration,
			icon,
			mask
		} = options;
		uni.showToast({
			title: title,
			duration: 2000,
			icon: icon || "none",
			mask: mask || false
		});
	},

	// 绘制图片  获取图片信息
	getImageInfo: async (imgSrc) => {
		return new Promise((resolve, errs) => {
			uni.getImageInfo({
				src: imgSrc,
				success: function(image) {
					resolve(image);
				},
				fail(err) {
					errs(err);
				}
			});
		});
	},
}
